]> git.neil.brown.name Git - wiggle.git/commitdiff
vpatch: allow relevant signals to cause a core-dump.
authorNeilBrown <neilb@suse.de>
Tue, 12 Feb 2013 04:00:38 +0000 (15:00 +1100)
committerNeilBrown <neilb@suse.de>
Tue, 12 Feb 2013 04:00:38 +0000 (15:00 +1100)
We catch SIGBUS and SIGSEGV so the terminal can be reset.
But that means we don't see a core dump if there should be one.

So for those signals, clear the signal handler after reseting
the terminal, and return.  Then the core will be dumped.

Reported-by: Paul Wise <pabs3@bonedaddy.net>
vpatch.c

index 5a947dc524865987738aa2857306ab5eb4424a78..c7e84a64da0788866093ae3f6649bde2cddef166 100644 (file)
--- a/vpatch.c
+++ b/vpatch.c
@@ -2780,7 +2780,12 @@ static void catch(int sig)
        nl();
        endwin();
        printf("Died on signal %d\n", sig);
-       exit(2);
+       fflush(stdout);
+       if (sig != SIGBUS && sig != SIGSEGV)
+               exit(2);
+       else
+               /* Otherwise return and die */
+               signal(sig, NULL);
 }
 
 static void term_init(void)